# -*- python -*-
# ex: set syntax=python:

# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# See master.experimental/slaves.cfg for documentation.

shards = {
  'linux': {
    'glibc': 6,
    'pnacl': 6,
    'clang': 6,
    'toolchain': 1,
    'emscripten': 1,
  },
  'mac': {
    'glibc': 2,
    'pnacl': 2,
    'clang': 2,
    'toolchain': 0,
    'emscripten': 0,
  },
}

platforms = sorted(shards.keys())
libcs = sorted(shards[platforms[0]].keys())

platform_to_version = {
  'linux': 'precise',
  'mac': '10.9',
}

platform_to_slavelist = {
  'linux': ['slave%d-c3' % i for i in range(48, 73)],
  'mac': ['vm%d-m3' % i for i in [609, 621, 623, 647, 659, 671]],
}

slaves = []
for platform in platforms:
  for slave in platform_to_slavelist[platform]:
    builders = []
    categories = []
    for when in ['', 'nightly-']:
      for index, libc in enumerate(libcs):
        order = {'': index, 'nightly-': index + len(libcs)}[when]
        for shard in range(shards[platform][libc]):
          builders.append('%s%s-%s-%d' % (when, platform, libc, shard))
          categories.append('%02d%s%s' % (order, when, libc))
    slaves.append({
      'master': 'WebPorts',
      'builder': builders,
      'categories': categories,
      'hostname': slave,
      'os': platform,
      'version': platform_to_version[platform],
      'bits': '64',
    })
